/* vue */
import { ref } from 'vue'

function useLoading() {
  
  const loading = ref(false)
  
  const setLoading = (value: boolean = true) => {
    loading.value = value
  }
  
  const showLoading = () => {
    setLoading(true)
  }
  
  const hideLoading = () => {
    setLoading(false)
  }
  
  const clearLoading = () => {
    loading.value = false
  }
  
  return {
    loading,
    setLoading,
    clearLoading,
    showLoading,
    hideLoading
  }
}

export {
  useLoading
}
